package com.imooc.ad.client;

import com.imooc.ad.client.vo.AdPlan;
import com.imooc.ad.client.vo.AdPlanGetRequest;
import com.imooc.ad.vo.CommonResponse;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 断路器Hystrix，防止因为要调用的服务下线，重复调用报错，而导致雪崩
 */
@Component
public class SponsorClientHystrix implements SponsorClient {

    @Override
    public CommonResponse<List<AdPlan>> getAdPlans(AdPlanGetRequest request) {

        //返回空的CommonResponse，以及错误消息
        return new CommonResponse<>(-1, "eureka-client-ad-sponsor error");
    }

}
